package pythagorean

const testVersion = 1

type Triplet [3]int

func Range(min, max int) (r []Triplet) {
	r = make([]Triplet, 0)
	for i := min; i <= max; i++ {
		for j := i; j <= max; j++ {
			for k := j; k <= max; k++ {
				if i*i+j*j == k*k {
					r = append(r, Triplet{i, j, k})
					continue
				}
			}
		}
	}

	return
}

func Sum(p int) (s []Triplet) {
	r := Range(1, p)
	s = make([]Triplet, 0)
	for _, v := range r {
		if v[0]+v[1]+v[2] == p {
			s = append(s, v)
		}
	}

	return
}
